<template>
  <div class="guanlileixing">
    <el-dialog title="同步备注配置" center :visible.sync="log" width="850px" :close-on-click-modal="false"
      :close-on-press-escape="false">
      <div class="kflexc" style="margin-bottom: 20px;">
        <div>启用</div>
        <div style="margin: 0 10px;"><el-switch v-model="all.main_switch" active-color="rgb(8, 201, 160)" inactive-color="rgb(220, 220, 220)"
            :active-value='1' :inactive-value='0'></el-switch></div>
        <div>启用后本页面配置生效，原订单备注同步将失效</div>
      </div>
      <div style="border: 1px rgb(215, 215, 215) solid; text-align: center;">

        <div>
          <div class="kflexc" style="background: rgb(246, 246, 246); border-bottom: 1px rgb(215, 215, 215) solid ; border-bottom: 0;">
            <div class="fenleil1">一级分类</div>
            <div class="fenleil2" style="background: rgb(246, 246, 246); border-bottom: 1px rgb(215, 215, 215) solid ;">二级分类</div>
          </div>
          <div class="kflexc gli" >
            <div class="fenleil1">抓单信息</div>
            <div class="fenleil2">
              <el-checkbox v-model="all.user_age_switch" :disabled="all.main_switch != 1" :true-label="1" :false-label="0">用户年龄</el-checkbox>
            </div>
          </div>
          <div class="kflexc gli" >
            <div class="fenleil1">生产信息</div>
            <div class="fenleil2">
              <div>
                <el-checkbox v-model="all.produce_success_switch" :disabled="all.main_switch != 1" :true-label="1" :false-label="0">生产成功</el-checkbox>
                <el-checkbox v-model="all.produce_number_switch" :disabled="all.main_switch != 1" :true-label="1" :false-label="0">生产号码</el-checkbox>
                <el-checkbox v-model="all.package_name_switch" :disabled="all.main_switch != 1" :true-label="1" :false-label="0">套餐名称</el-checkbox>
              </div>
              <div>
                <el-checkbox v-model="all.produce_fail_switch" :disabled="all.main_switch != 1" :true-label="1" :false-label="0">生产失败</el-checkbox>
                <el-checkbox v-model="all.produce_reason_swtich" :disabled="all.main_switch != 1" :true-label="1" :false-label="0">失败原因</el-checkbox>
              </div>
              <div>
                <el-checkbox v-model="all.new_package_name_switch" :disabled="all.main_switch != 1" :true-label="1" :false-label="0">改单/转单套餐</el-checkbox>
              </div>
            </div>
          </div>
          <div class="kflexc gli" >
            <div class="fenleil1">外呼信息</div>
            <div class="fenleil2">
              <div>
                <el-checkbox v-model="all.call_label_switch" :disabled="all.main_switch != 1" :true-label="1" :false-label="0">意向标签</el-checkbox>
              </div>
              <div>
                <el-checkbox v-model="all.call_remark_switch" :disabled="all.main_switch != 1" :true-label="1" :false-label="0">外呼备注</el-checkbox>
              </div>
              <div>
                <el-checkbox v-model="all.order_flag_switch" :disabled="all.main_switch != 1" :true-label="1" :false-label="0">标旗</el-checkbox>
              </div>
            </div>
          </div>
          <div class="kflexc gli" >
            <div class="fenleil1">发货信息</div>
            <div class="fenleil2">
              <div>
                <el-checkbox v-model="all.tracking_number_switch" :disabled="all.main_switch != 1" :true-label="1" :false-label="0">物流单号</el-checkbox>
              </div>
              <div>
                <el-checkbox v-model="all.tracking_company_switch" :disabled="all.main_switch != 1" :true-label="1" :false-label="0">物流公司</el-checkbox>
              </div>
              <div>
                <el-checkbox v-model="all.tracking_status_switch" :disabled="all.main_switch != 1" :true-label="1" :false-label="0">最新物流状态</el-checkbox>
              </div>
            </div>
          </div>
          <div class="kflexc gli" >
            <div class="fenleil1">激活状态</div>
            <div class="fenleil2">
              <div>
                <el-checkbox v-model="all.active_status_switch" :disabled="all.main_switch != 1" :true-label="1" :false-label="0">激活状态</el-checkbox>
              </div>
              <div>
                <el-checkbox v-model="all.activated_at_swtich" :disabled="all.main_switch != 1" :true-label="1" :false-label="0">激活时间</el-checkbox>
              </div>
              <div>
                <el-checkbox v-model="all.recharge_status_switch" :disabled="all.main_switch != 1" :true-label="1" :false-label="0">首充状态</el-checkbox>
              </div>
              <div>
                <el-checkbox v-model="all.first_recharge_at_switch" :disabled="all.main_switch != 1" :true-label="1" :false-label="0">首充时间</el-checkbox>
              </div>
            </div>
          </div>
        </div>
        <div>

        </div>
      </div>

      <span slot="footer" class="dialog-footer" style="text-align: center;">
        <el-button type="info" round @click="log = false">取消</el-button>
        <el-button type="danger" round @click="baocun">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
  import axios from "axios";
  export default {
    name: 'douyinfahuopeizhi',
    props:['id'],
    data() {
      return {
        log: false,
        all: {
          produce_fail_switch: "", //生产失败
          produce_number_switch: "", //生产号码
          package_name_switch: "", //套餐名称
          new_package_name_switch: "", //套餐名称
          produce_reason_swtich: "", //生产原因
          call_label_switch: "", //意向标签
          call_remark_switch: "", //意向标签
          order_flag_switch: "", // 标旗
          tracking_number_switch: "", //物流单号
          tracking_company_switch: "", //物流公司
          tracking_status_switch: "", // 物流状态
          active_status_switch: "", //激活状态
          activated_at_swtich: "", //激活时间
          config_type: "", //配置类型
          main_switch: "", //总开关
          user_age_switch: "", //用户年龄
          produce_success_switch: "", //生产成功
        },
        // {
        // "title": "京东抓单",
        // "value": 1
        // },
        // {
        // "title": "拼多多(自研)",
        // "value": 2
        // },
        // {
        // "title": "有赞",
        // "value": 3
        // },
        // {
        // "title": "新版天猫",
        // "value": 4
        // },
        // {
        // "title": "快手",
        // "value": 5
        // },
        // {
        // "title": "抖音",
        // "value": 6
        // },
        // {
        // "title": "小红书",
        // "value": 7
        // },
        // {
        // "title": "直播",
        // "value": 8
        // }
      }
    },
    created() {


    },
    methods: {
      chushihua: function() {
        this.getlist()
      },
      getlist: function() {
        axios.get('/api/order_memo/config/index')
          .then(response => {
            if (response.data.msg.code == 0) {

                response.data.data.forEach(item=>{
                  if(this.id == 'jd'){
                    if(item.config_type == 1){
                      this.all = item
                    }
                  }
                  if(this.id == 'pdd'){
                    if(item.config_type == 2){
                      this.all = item
                    }
                  }
                  if(this.id == 'yz'){
                    if(item.config_type == 3){
                      this.all = item
                    }
                  }
                  if(this.id == 'tm'){
                    if(item.config_type == 4){
                      this.all = item
                    }
                  }
                  if(this.id == 'ks'){
                    if(item.config_type == 5){
                      this.all = item
                    }
                  }
                  if(this.id == 'jd'){
                    if(item.config_type == 1){
                      this.all = item
                    }
                  }
                  if(this.id == 'dy'){
                    if(item.config_type == 6){
                      this.all = item
                    }
                  }

                })

              if(this.all.config_type == ''){
                this.$message.error('没找到对应的值');
              }else{
                this.log = true
              }
            } else {
              this.$message.error(response.data.msg.info);
            }
          })
      },
      baocun: function() {
        axios.post('/api/order_memo/config/store', this.all)
          .then(response => {
            if (response.data.msg.code == 0) {
              this.$message.success('操作成功');
              this.log = false
            } else {
              this.$message.error(response.data.msg.info);
            }
          })
      }
    }
  }
</script>

<style lang="scss" scoped>
  .guanlileixing {
    .gli{
      border: 1px rgb(215, 215, 215) solid;
      margin-left: -1px;
      margin-top: -1px;
      border-right: 0;
    }
    .fenleil1 {
      width: 180px;


    }

    .fenleil2 {
      text-align: left; padding: 10px 30px;
      line-height: 40px;
      background: rgb(255, 255, 255);
      flex-grow: 1;
      border-left: 1px rgb(215, 215, 215) solid;
    }
  }
</style>
